﻿using System.Web.Security;

namespace Kratos.Framework.Infrastructures
{
    public interface IFormsAuthentication
    {
        void SignOut();
        void SetAuthCookie(string username, bool createPersistentCookie);
        string HashPassword(string password);
    }

    public class FormsAuthenticationWrapper : IFormsAuthentication
    {
        public void SignOut()
        {
            FormsAuthentication.SignOut();
        }

        public void SetAuthCookie(string username, bool createPersistentCookie)
        {
            FormsAuthentication.SetAuthCookie(username, createPersistentCookie);
        }

        public string HashPassword(string password)
        {
            return FormsAuthentication.HashPasswordForStoringInConfigFile(password, "SHA1");
        }
    }
}
